package com.gwm.item.controller;

import com.gwm.item.service.ItemService;
import com.gwm.item.pojo.Item;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/item")
public class ItemController {

    @Autowired
    private ItemService itemService;

    @PostMapping("/save")
    public ResponseEntity<Item> save(@RequestBody Item item){

        Item item1 =  itemService.saveItem(item);

        return ResponseEntity.status(200).body(item1);

    }
}
